<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function computedRound(r) {
        if (r < 0) {
          return console.log("请输入正数");
        }
        return (Math.PI * r * r).toFixed(2) + "m²";
      }

      console.log(computedRound(3));
    </script>
  </body>
</html>
